import "package:ct_pa_majordomo/pages/bill/complete_bill/index.dart";
import "package:ct_pa_majordomo/pages/bill/due_in_bill/index.dart";
import "package:ct_pa_majordomo/pages/widgets/page_view_switcher.dart";
import "package:flutter/cupertino.dart";

class Bill extends StatefulWidget {
  final int current;
  final Map? params;
  const Bill({super.key, required this.current, this.params});

  @override
  State<StatefulWidget> createState() => _BillState();

}

class _BillState extends State<Bill> {

  late final PageController _controller;

  @override
  void initState() {
    setState(() {
      _controller = PageController(initialPage: widget.current);
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return PageViewSwitcher(
      controller: _controller,
      items: const ["待收账单", "完成账单"],
      children: [
        DueInBill(params: widget.params),
        CompleteBill(),
      ],
    );
  }
}